Skip to content

Use khiops-core and khiops-driver-* pip packages containing binaries only#582

Open
tramora wants to merge 2 commits into
mainfrom
core-and-drivers-as-pip-packages
Open

Use khiops-core and khiops-driver-* pip packages containing binaries only#582
tramora wants to merge 2 commits into
mainfrom
core-and-drivers-as-pip-packages

Conversation

@tramora

@tramora tramora commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes #572 and #578


TODO Before Asking for a Review

  • Rebase your branch to the latest version of main (or main-v10)
  • Make sure all CI workflows are green
  • When adding a public feature/fix: Update the Unreleased section of CHANGELOG.md (no date)
  • Self-Review: Review "Files Changed" tab and fix any problems you find
  • API Docs (only if there are changes in docstrings, rst files or samples):
    • Check the docs build without warning: see the log of the API Docs workflow
    • Check that your changes render well in HTML: download the API Docs artifact and open index.html
    • If there are any problems it is faster to iterate by building locally the API Docs

@tramora tramora marked this pull request as draft May 26, 2026 16:23
@tramora tramora force-pushed the core-and-drivers-as-pip-packages branch 9 times, most recently from caa2f18 to fd7c550 Compare May 28, 2026 10:32
@tramora tramora marked this pull request as ready for review May 28, 2026 13:44
@tramora tramora requested a review from popescu-v May 28, 2026 13:44
@tramora tramora force-pushed the core-and-drivers-as-pip-packages branch 2 times, most recently from 394d474 to 5312426 Compare May 28, 2026 21:33
@tramora

tramora commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

False sentiment of success : we simulate multiple Python environments using conda (#573). This is very unfortunate as we are not able yet to detect automatically an issue with the new PyPI packages regarding the remote drivers khiops-core:1041. In my opinion this one is a blocking issue.

@tramora tramora force-pushed the core-and-drivers-as-pip-packages branch from 5312426 to b0223fa Compare May 29, 2026 00:37
@popescu-v

Copy link
Copy Markdown
Collaborator

False sentiment of success : we simulate multiple Python environments using conda (#573). This is very unfortunate as we are not able yet to detect automatically an issue with the new PyPI packages regarding the remote drivers khiops-core:1041. In my opinion this one is a blocking issue.

Hence, to properly test this, issue #573 must be addressed first. Right, @tramora ?

@tramora tramora force-pushed the core-and-drivers-as-pip-packages branch from 95a1d21 to cfd1802 Compare May 29, 2026 09:43
Comment thread .github/workflows/api-docs.yml Outdated
Comment thread .github/workflows/dev-docker.yml Outdated
Comment thread .github/workflows/pip.yml Outdated
Comment thread .github/workflows/quick-checks.yml Outdated
Comment thread .github/workflows/quick-checks.yml Outdated
Comment thread .github/workflows/tests.yml
Comment thread .github/workflows/tests.yml Outdated
Comment thread .github/workflows/tests.yml Outdated
Comment thread khiops/core/internals/filesystems.py Outdated
Comment thread khiops/core/internals/filesystems.py Outdated
Comment thread khiops/core/internals/filesystems.py Outdated
@tramora

tramora commented May 29, 2026

Copy link
Copy Markdown
Collaborator Author

False sentiment of success : we simulate multiple Python environments using conda (#573). This is very unfortunate as we are not able yet to detect automatically an issue with the new PyPI packages regarding the remote drivers khiops-core:1041. In my opinion this one is a blocking issue.

Hence, to properly test this, issue #573 must be addressed first. Right, @tramora ?

I changed the $CONDA install -y -n env ... to $CONDA run -n env pip install ... in order to really use the PyPI packages.
But it is not perfect yet as the run will set the CONDA_PREFIX environment variable that is checked by khiops-python to determine if the installation is done in a 'conda' method or not. 'conda' method and 'pip' one are close but not totally identical

Comment thread .github/workflows/quick-checks.yml
Comment thread .github/workflows/tests.yml
Comment thread .github/workflows/tests.yml
Comment thread .github/workflows/tests.yml
Comment thread .github/workflows/tests.yml
Comment thread khiops/core/internals/runner.py
Comment thread khiops/core/internals/runner.py Outdated
Comment thread khiops/core/internals/filesystems.py Outdated
an absolute path is inferred using the current folder which will probably
cause an error eventually.

this method raises a `RuntimeError` if the dynamic library is not found

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformat this line to:

Raises
-------
`RuntimeError`
    The dynamic library of the driver is not found.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/the dynamic library/The dynamic library/ (capital "T").

Comment thread khiops/core/internals/filesystems.py Outdated
@tramora tramora force-pushed the core-and-drivers-as-pip-packages branch 2 times, most recently from 4a72d1f to db651cb Compare June 11, 2026 07:53
@tramora tramora requested a review from popescu-v June 11, 2026 07:54
Thierry RAMORASOAVINA added 2 commits June 15, 2026 12:04
…ries only

- these packages become mandatory ("khiops-core") or optional ("khiops-driver-*") dependencies dragged during the installation process
- these packages must be installed in the Conda environments used to simulate multiple environs (the Conda packages MUST not be used)
- in order to avoid distorting usage statistics the test workflows will always use khiops packages from TestPypi
@tramora tramora force-pushed the core-and-drivers-as-pip-packages branch from db651cb to ad82998 Compare June 15, 2026 10:05
`Dockerfile.ubuntu-debian` is a unique Dockerfile to build either a Ubuntu or a Debian target image
because there is no difference except for the base image used.

The only reason why the system-wide native Khiops binary (from a `.deb` package) is still installed in the target image

@popescu-v popescu-v Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, we can leave that restriction aside if we just install via Pip in a virtualenv, then set the KHIOPS_CMD and KHIOPS_COCLUSTERING_CMD environment variables accordingly. See: https://github.com/KhiopsML/khiops-server/blob/7050d79fb608c59eed4831838d3753867a2a80f6/server/server.go#L63 and https://github.com/KhiopsML/khiops-server/blob/7050d79fb608c59eed4831838d3753867a2a80f6/server/server.go#L70. I would set these in the CI where applicable.

type: string
default: 11.0.0
description: Khiops Revision
description: Khiops Revision (for tests against KhiopsDockerRunner)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use virtualenv and set KHIOPS_CMD and KHIOPS_COCLUSTERING_CMD (see the previous comment).

Raises
------
`RuntimeError`
the dynamic library of the driver is not found

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use capital "T" in "the dynamic".

Comment on lines +838 to +843
khiops_drivers_path = os.environ.get("KHIOPS_DRIVERS_PATH")
if khiops_drivers_path:
_check_khiops_driver_library(
remote_storage_type="azure", khiops_drivers_path=khiops_drivers_path
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should access KHIOPS_DRIVERS_PATH directly. Normally, this environment variable name should be abstracted away by the KhiopsLocalRunner. I would create specific attribute for accessing it instead, e.g. khiops_drivers_path, akin to khiops_path and khiops_coclustering_path.

in the python system folder
or in the Python folder inside the home directory of the user,
or in a virtual environment (if one is used)
- 'pip' environment containing binaries, shared libraries and the python libraries

@popescu-v popescu-v Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/python/Python/

- 'pip' environment containing binaries, shared libraries and the python libraries
can either be :
- system-wide (strongly discouraged)
- or in the Python folder inside the home directory of the user (aka "User site"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/aka/a.k.a./

Comment on lines +983 to +984
"Make sure you have installed properly the Khiops Python library "
"and Khiops (if the latter was not installed automatically). "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simplify a bit to just:
"Make sure you have installed Khiops properly."

Actually, the whole point of the "full Pip" installation route (alongside the "full Conda" one) is to abstract away the "Khiops Python library" / "Khiops binaries" dichotomy (which can be kept in the developer comments though, but not in the user-facing warnings, messages or feedback IMHO).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very comfortable with the vague "Khiops" word as we show messages to the end user.

Indeed the user is using "The Khiops Python Library" so it is his/her starting point that why I would like to be precise on this point but I will follow

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then we could keep "Make sure you have installed the Khiops Python library correctly.", without mentioning the "and Khiops" and the latter being installed differently, because it would be out of the scope of the "full Pip" installation IMHO.

On the other hand, if a user deliberately chooses to uninstall the khiops-core package in order to replace the binaries with, say, a locally-built Khiops Core set of binaries, then that user would not need this kind of warning in the first place, IMHO.

"The 'khiops_env' script not found for the current "
f"'{installation_method}' installation method. Make sure "
"you have installed khiops >= 10.2.3. "
"you have installed properly the Khiops Python library "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify to "you have installed Khiops properly." (see relevant comment above).

# On Windows "KHIOPS_MPI_DLL_PATH" (containing the Intel MPI Library)
# must be added to "PATH" otherwise Khiops wouldn't find it
# and fail immediately
elif var_name == "KHIOPS_MPI_DLL_PATH":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"See https://khiops.org for more information.",
)

# Warn if the khiops minor and patch versions do not match

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure all this still applies: if khiops-python is installed, then khiops-core is installed. If khiops-core is uninstalled by the user afterwards, then the environment initialization fails.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least during the making of the current PR, the case occurs :

  • Khiops is 11.0.1rc1
  • The Khiops Library is 11.0.0.3 (in the PR branch)
    Surely the khiops team won't let this occur in the final release but who knows ?

compatible_khiops_version = khiops.get_compatible_khiops_version()

operating_system = platform.system()
installation_method = _infer_khiops_installation_method()

@popescu-v popescu-v Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove all code after self._khiops_version, because the version mismatch would no longer be relevant here: it would be given by the package metadata (Conda or Pip) - see the comment below as well.

LABEL description="Container for the development of khiops-python"

# Install dev tools and miniforge (for the unit tests); build and install Khiops
# Install dev tools and miniforge (for the unit tests); install Khiops (only for tests against KhiopsDockerRunner)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop this and set the KHIOPS_CMD and KHIOPS_COCLUSTERING_CMD to point to the specific Pip installation in the CI (see the other comments in this respect).

Comment on lines 19 to 28
# Get Linux distribution codename \
&& if [ -f /etc/os-release ]; then . /etc/os-release; fi \
# Obtain the Khiops native package \
&& KHIOPS_PKG_FILE=$KHIOPS_REVISION/khiops-core-openmpi_$KHIOPS_REVISION-1-$VERSION_CODENAME.amd64.deb \
&& wget -O KHIOPS_CORE.deb "https://github.com/KhiopsML/khiops/releases/download/${KHIOPS_PKG_FILE}" \
# Install the Khiops native package : make it always succeed. \
# If dpkg fails it is due to missing dependencies which will be installed by apt in the next line \
&& (dpkg -i --force-all KHIOPS_CORE.deb || true) \
&& apt-get -f -y install \
&& rm -f KHIOPS_CORE.deb \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this altogether and have the Docker runner use the Pip installation in the CI (see the other comments in this respect).


# Install dev tools and miniforge (for the unit tests); build and install Khiops
# Install dev tools and miniforge (for the unit tests); install Khiops (only for tests against KhiopsDockerRunner)
ARG KHIOPS_REVISION

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this and use virtualenv in the CI (see the other comments in this respect).

@popescu-v popescu-v left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See pending comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Depend on the khiops-core Pip Package

2 participants